package cn.com.pajx.pajx_smart_platform.mvp.model;


import cn.com.pajx.pajx_smart_platform.api.HttpResponse;
import cn.com.pajx.pajx_smart_platform.api.HttpUtils;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import okhttp3.ResponseBody;

/**
 * Created by ruancw on 2023/04/03.
 * 通用model实现类
 */

public class CommonModelImpl implements IBaseModel {
    private IOnRequestListener onRequestListener;

    public CommonModelImpl(IOnRequestListener onRequestListener) {
        this.onRequestListener = onRequestListener;
    }

    @Override
    public <T> Disposable getObservable(Observable<HttpResponse<T>> observable, String tag) {
        return HttpUtils.getDisposable(observable, tag, onRequestListener);
    }

    @Override
    public Disposable getFileObservable(Observable<ResponseBody> observable, String tag) {
        return HttpUtils.getFileDisposable(observable, tag, onRequestListener);
    }
}
